<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<script type="text/javascript">
	var tool=[{
			text:"导出",
			iconCls:"icon-add",
			handler:function(){
				$.post("Warehouse/outPut",{},function(data){
					if(data.state == 200){
						$.messager.alert('提示','导出成功，请在D盘根目录下查看');
						$("#ta").datagrid("reload");
					}else{
						$.messager.alert('提示','导出失败');
					}
				});
			}
		},{
			text:"申请",
			iconCls:"icon-help",
			handler:function(){
				var obj=$("#ta").datagrid("getSelections");
				if(obj==null||obj.length!=1){
					$.messager.alert('提示','请选择您想添加的库存')
				}else{
					$("#d").window({
						title:"申请商品",
						width:"80%",
						height:"80%",
						modal:true,
						href:"application"
					});
				}
			}
		}];
	//图片展示  
	function showImg(value, row, index){  
	    if(row.drugimg){  
	        return "<img style='width:70px;height:50px;' border='1' src='"+row.drugimg+"'/>";  
	    }  
	}
</script>   
<table id="ta" class="easyui-datagrid" style="width:63%" data-options="toolbar:tool,pagination:true,url:'Warehouse/findAllInfo',fitColumns:true,singleSelect:true">
	<thead>
		<tr class="tr">
			<th data-options="field:'drugid',width:200,align:'center',sorttable:true">药品ID</th>
			<th data-options="field:'drugimg',width:200,align:'center',sorttable:true,formatter:showImg">药品配图</th>
			<th data-options="field:'drugname',width:200,align:'center',sorttable:true">药品名称</th>
			<th data-options="field:'proname',width:200,align:'center',sorttable:true">生产商</th>
			<th data-options="field:'drugnum',width:100,align:'center',sorttable:true">药品库存</th>
		</tr>
	</thead>
</table>
<div id="d"></div>